package com.ccm.demo.control.controller;

import com.alibaba.fastjson.JSONObject;
import com.ccm.demo.model.api.UserService;
import com.ccm.demo.model.entity.User;
import org.apache.dubbo.config.annotation.Reference;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class UserController {

	@Reference
	private UserService userService;

	@RequestMapping("getAllUsers")
	public JSONObject getAllUsers(){
		JSONObject json = new JSONObject();
		List<User> users = userService.getAllUsers();
		json.put("data",users);
		json.put("code",1);
		return json;
	}
}
